Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

docs: Change wrong info about controller default scope #885

Merged
merged 2 commits into from
Jan 10, 2024

Conversation

matrei
Copy link
Contributor

@matrei matrei commented Dec 25, 2023

No description provided.

@puneetbehl
Copy link
Contributor

There used to be a default configuration to set the default scope for controller as Singleton. If this is not the case this is a bug. I have noticed that somewhere we have accidentally removed the following from the application.yml in Grails 6.

grails
    controllers:
        defaultScope: singleton

@matrei
Copy link
Contributor Author

matrei commented Jan 9, 2024

@puneetbehl Yes, the missing configuration is also an issue: grails/grails-forge#263. But changing the default scope in configuration does not make it the default scope of the framework. The default scope of controllers in Grails is prototype unless changed in config. The docs says different things in different places: https://docs.grails.org/6.1.1/guide/single.html#_scoped_controllers, https://docs.grails.org/6.1.1/ref/Controllers/scope.html. I also think that the default controller scope should eventually be changed, as proposed by grails/grails-core#13332.

@puneetbehl
Copy link
Contributor

The default scope in the framework is configured to prototype. For newly created application it overridden by the above mentioned configuration. The idea behind it was to change the default scope to singleton in next major Grails version and remove it from the configuration which is clearly missed. I think we should merge grails/grails-core#13332 and update the documentation to reflect singleton as the default scope.

@matrei
Copy link
Contributor Author

matrei commented Jan 9, 2024

Yes, I agree! But for Grails 6.1.x the documentation is wrong and this PR addresses that.

@puneetbehl
Copy link
Contributor

The documentation will only be released with the next patch or minor release where we will change the default to singleton as this is a bug and the change was not intentional. So, I think we should keep the singleton as the default option and fix the problem in Grails Core.

The docs says different things in different places:

We should address it in this PR.

@matrei
Copy link
Contributor Author

matrei commented Jan 9, 2024

I think we need to separate the issues in grails-forge and grails-core.

The bugfix in grails-forge should be applied to both 6.0.x and 6.1.x where the default controller scope is still prototype.

We should not change default controller scope in grails-core 6.1.x or earlier as that would change behavior in a patch release.
In grails-core 6.2.x it could be changed and there also change the documentation about this.

After the behavior has been updated in grails-core 6.2.x the configuration can be removed in grails-forge 6.2.x as it will then be superfluous.

However, this PR is regarding behavior in grails-core 6.1.x where the default controller scope is still prototype and the documentation says it is singleton.

@puneetbehl puneetbehl merged commit 0f1e201 into grails:6.1.x Jan 10, 2024
1 of 2 checks passed
@matrei matrei deleted the matrei/singleton-controllers branch January 10, 2024 14:42
jamesfredley added a commit that referenced this pull request Nov 11, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants